/*
 * @Author: Bennty
 * @Date: 2024-11-06 10:18:34
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-11-06 14:57:25
 * @Description: 请填写简介
 */
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductOrderFormType,QueryProductOrderType,ProductOrderVO } from './types';


/** 生产单根据名称检索产品列表 */
export const getBomByCustomerNameApi = (bomName: string) => {
    return request({
        url: '/system/bomInfo/getBomListByName',
        method: 'get',
        params: {bomName: bomName}
    })
};

/** 新增生产单 */
export const addProductOrderApi = (data: ProductOrderFormType) => {
    return request({
        url: '/system/productionOrder',
        method: 'post',
        data: data
    })
};

/** 查询生产单列表 */
export const getProductOrderListApi = (data: QueryProductOrderType):AxiosPromise<ProductOrderVO[]> => {
    return request({
        url: '/system/productionOrder/list',
        method: 'post',
        data: data
    })
};

/** 修改生产单 */
export const editProductOrderApi = (data: ProductOrderFormType) => {
    return request({
        url: '/system/productionOrder',
        method: 'put',
        data: data
    })
};

/** 获取生产单详细信息 */
export const getOrderDetailByIdApi = (id: string | number) => {
    return request({
        url: `/system/productionOrder/${id}`,
        method: 'get'
    });
};

/** 下生产单 */
export const placeOrderApi = (data: any) => {
    return request({
        url: `/system/productionOrder/makeProduceOrder`,
        method: 'post',
        data: data
    });
};

/** 删除生产单 */
export const deleteProductOrderApi = (ids: any) => {
    return request({
        url: `/system/productionOrder/${ids}`,
        method: 'delete',
    });
};